package com.ali.juejin.adapter

import android.content.Context
import androidx.databinding.ViewDataBinding
import androidx.recyclerview.widget.LinearLayoutManager
import com.ali.juejin.BR
import com.ali.juejin.R
import com.ali.juejin.base.BaseModelListAdapter
import com.ali.juejin.bean.v1.article.comment.Data
import com.ali.juejin.bean.v1.article.comment.ReplyInfo
import com.ali.juejin.databinding.ItemReplyCommentBinding
import kotlinx.android.synthetic.main.item_article_comment.view.*

class ArticleCommentListAdapter<K:ViewDataBinding,L>(mContext:Context,br:Int): BaseModelListAdapter<K, L>(mContext,br) {

    override fun getLayout(): Int {
        return R.layout.item_article_comment
    }

    override fun onBindViewHolder(holder: ListHolder<K>, position: Int) {
        super.onBindViewHolder(holder, position)
        val articleReplyListAdapter = ArticleReplyListAdapter<ItemReplyCommentBinding,ReplyInfo>(holder.itemView.context,BR.replyModel)
        holder.itemView.article_reply_comment.layoutManager = LinearLayoutManager(holder.itemView.context, LinearLayoutManager.VERTICAL,false)
        holder.itemView.article_reply_comment.adapter = articleReplyListAdapter
//        LogUtils.wTag("列表",userId)
        val item = list[position] as Data
        articleReplyListAdapter.load(item.reply_infos as ArrayList<ReplyInfo>)

    }

}